Google Apps Script函式庫
新增函式庫
1. 「Libraries」
2. 貼上script id
3. 追加
GitHub - contributorpw/google-apps-script-awesome-list: The usual list of links to interesting resources for Google Apps Script
Cheerio
GitHub - tani/cheeriogs: Cheerio for Google Apps Script
$ 1ReeQ6WO8kKNxoaA_O0XEQ589cIrRvEBA9qcWpNqdOP17i47u6N9M5Xh0
code:gs(javascript)
function getContent_(url) {
return UrlFetchApp.fetch(url).getContentText()
}
const content = getContent_('https://en.wikipedia.org');
const $ = Cheerio.load(content);
Logger.log($('#mp-right').text());
OAuth2
googleworkspace/apps-script-oauth2: An OAuth2 library for Google Apps Script.
$ 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF
單元測試
$ 1Bnt8-tN4ddGVzXXIkzV_AtuuMzdlmlSyKWO7KS4TAVQYgM2GJT5WC9eU
code:test.gs(javascript)
const exports = GASUnit.exports
const assert = GASUnit.assert
function test() {
exports({
'sum': {
'1 + 2 = 3': () => {
assert(sum(1, 2) === 3)
},
},
'hello': {
'Hello world!': () => {
assert(hello('world!') === 'Hello world!')
}
}
})
}